package mvc;
import javax.swing.*;

import java.awt.Dimension;
import javax.swing.JButton;
import java.awt.Rectangle;

public class IG  extends JFrame {
	/**
	 * 
	 */
	private static final long serialVersionUID = 9116265521770019420L;
	BancoDeDados bd=new BancoDeDados();
	AgendaControl agendaControl = new AgendaControl();
	AgendaModel agendaModel = new AgendaModel(bd);
	ProntuarioControl prontuarioControl = new ProntuarioControl();
	ProntuarioModel prontuarioModel = new ProntuarioModel(bd);

	private JFrame iSaude = null;  //  @jve:decl-index=0:visual-constraint="138,81"
	private JPanel jContentPane = null;
	private JButton Prontuario = null;
	private JButton Agenda = null;

	public IG() {
		prontuarioControl.setModel(prontuarioModel);
		prontuarioModel.addObserver(prontuarioControl);
		agendaControl.setModel(agendaModel);

		iSaude = getISaude();
		iSaude.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		prontuarioControl.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
		agendaControl.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);


		iSaude.setVisible(true);
	}

	/**
	 * This method initializes iSaude	
	 * 	
	 * @return javax.swing.JFrame	
	 */
	private JFrame getISaude() {
		if (iSaude == null) {
			iSaude = new JFrame();
			iSaude.setSize(new Dimension(430, 143));  // Generated
			iSaude.setTitle("iSaude");  // Generated
			iSaude.setContentPane(getJContentPane());  // Generated
		}
		return iSaude;
	}
	/**
	 * This method initializes jContentPane	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getJContentPane() {
		if (jContentPane == null) {
			jContentPane = new JPanel();
			jContentPane.setLayout(null);  // Generated
			jContentPane.add(getProntuario(), null);  // Generated
			jContentPane.add(getAgenda(), null);  // Generated
		}
		return jContentPane;
	}
	/**
	 * This method initializes Prontuario	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getProntuario() {
		if (Prontuario == null) {
			Prontuario = new JButton();
			Prontuario.setBounds(new Rectangle(32, 22, 168, 75));  // Generated
			Prontuario.setText("Prontuario");  // Generated
			Prontuario.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					System.out.println("actionPerformed()");
					prontuarioControl.setVisible(true);
				}
			});
		}
		return Prontuario;
	}
	/**
	 * This method initializes Agenda	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getAgenda() {
		if (Agenda == null) {
			Agenda = new JButton();
			Agenda.setBounds(new Rectangle(233, 22, 168, 75));  // Generated
			Agenda.setText("Agenda");  // Generated
			Agenda.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					System.out.println("actionPerformed()");
					agendaControl.setVisible(true);
				}
			});

		}
		return Agenda;
	}

	public static void main(String [] args) {
		IG ig = new IG();
		ig.bd.addCEP("123456");
		ig.bd.addCEP("478965");

		ig.bd.addMedico("Izildo");

		ig.bd.addProntuario("Talita Almeida", "22/02/1972", "", "11.111.111-1", "Rua Oi,9", "Jd Baixo", "Aqui", "Sampa", "123654789", "456878", "54687", "123456", "27/07/2007", "1");

	}
}  //  @jve:decl-index=0:visual-constraint="525,13"
